package cn.tianyigps.tianyigpsapiv2.dao;

import cn.tianyigps.tianyigpspublic.bean.EquipmentLastData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;


/**
 * @Author: LiuHao
 * @Descirption:
 * @Date: 2019/4/26_16:03
 */
@Repository
public class EquipmentLastDataDao extends BaseDao<EquipmentLastData> {


    @Autowired
    private MongoTemplate mongoTemplate;

    public EquipmentLastData lastData(String equipmentId) {
        Query query = new Query(Criteria.where("equipmentId").is(equipmentId));
        EquipmentLastData equipmentLastData = mongoTemplate.findOne(query,EquipmentLastData.class);
        return equipmentLastData;
    }

}
